# while

"""
i = 0
while i<100:
    print("小美%d"%(i+1))
    i+=1

"""


# 循环求和
"""
i = 0
sum = 0
while i<=100:
    sum = sum + i
    i+=1

print(f"{sum}")


"""

# 无限次数 猜数字
"""
import random
num = random.randint(1,100) # 产生1-100随机数字

i = 1

guess = int(input("猜数字"))
while guess!=num:
    if guess >num:
        print("猜大了")
    else:
        print("猜小了")
    guess = int(input("猜数字"))
    i+=1

print(f"恭喜你猜对了，你猜的次数是：{i}")

"""

# 无限次数 猜数字2
"""
import random
num = random.randint(1,100)

flag = True
i = 0
while flag:
    guess = int(input("开始猜数字吧"))
    i+=1
    if guess==num:
        print("恭喜你猜对了")
        flag = False
    else:
        if guess>num:
            print("猜大了")
        else:
            print("猜小了")
print(f"恭喜你猜对了，你猜的次数是：{i}")



"""


# end = ' '
"""
print("hello")
print("world")

print("hello ",end = '')
print("world")


"""

# 9*9 乘法表
"""

i = 1
while i<=9:
    j=1
    while j<=i:
        print(f"{j}*{i}=%d\t"%(i*j),end = ' ')
        j+=1
    print()
    i+=1

"""



# for 循环
"""
num = 0
name = "itheima is a brand of itcast"
for x in name:
    if x=='a':
        num+=1
print("num = %d"%num)

"""

# range 语句的使用
"""
for x in range(5):
    print(x,end = ' ')
print()
for x in range(5,10):
    print(x,end = ' ')
print()
for x in range(5,10,2):
    print(x,end = ' ')
print()

"""

# range 案例 ：有几个偶数

"""
num = int(input("请输入一个数字："))
count = 0
for x in range(num):
    if x%2==0:
        count+=1
print("0-num共有%d个偶数"%count)

"""
# 表白案例
"""

for x in range(1,21):
    print(f"今天是跟小美表白的第{x}天")
    
    # 内层循环
    for j in range(1,11):
        print(f"送出第{j}朵花")
    print(f"第{x}天表白结束")


"""


# for循环实现乘法表
"""
for x in range(1,10):
    for y in range(1,x+1):
        print(f"{y}*{x}=%d\t"%(x*y),end = ' ')
    print()


"""


# continue

"""
for i in range(1,6):
    # print(i)
    if i%2==0:
        continue
        print(i)
    else:
        print(i)


"""

# 小案例
import random

account = 10000
for x in range(1,21):
    num = random.randint(1,10)
    if num<5:
        print(f"第{x}名员工的绩效分为{num}，低于5，不发工资，下一位")
        continue
    if account==0:
        print("工资发完了，下个月领取吧")
        break
    account = account - 1000
    print(f"向员工{x}发放工资1000元，账户余额还剩{account}")    


